/*
 * Topol.h
 *
 *  Created on: May 12, 2012
 *      Author: marchi
 */

#ifndef TOPOL_H_
#define TOPOL_H_
#include <vector>
#include <string>
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <sstream>


using std::vector;
using std::string;
using std::cout;
using std::endl;
namespace Topol_NS {
enum {Slt, Sol, Ions};
const int TYPES=3;
struct MyResidue{
	int n;
	string name;
};
class Topol {
	size_t nr;
	size_t nres;
	vector<string> atomname;
	vector<string> resinfo;
	vector<int> resind;
	vector<int> cidx[TYPES];
	string TypeNames[TYPES];
	void ExtractInfo(const vector<string> & data);
public:
	Topol();
	Topol(const vector<string> &);
	Topol & operator()(const vector<string> &);
	virtual ~Topol();
	const size_t Size(){return nr;}
	const size_t ResSize(){return nres;}
	const int ResIndex(const int n){return resind[n];};
	const vector<int> & getCidx(const size_t n){return cidx[n];}

	const vector<string> & getAtomName(){return atomname;}
	const string * getTypeNames(){return &TypeNames[0];};
	string AtomInfo(size_t n){
		try {if(n>=nr) throw "Atom number beyond bounds ";}
		catch(const char * s){cout << s << endl;exit(1);}
		return atomname[n];
	}
	string ResInfo(size_t n){
		try {if(n>=nres) throw "Residue number beyond bounds ";}
		catch(const char * s){cout << s << endl;exit(1);}
		return resinfo[n];
	}

};

} /* namespace Topol_NS */
#endif /* TOPOL_H_ */
